/**
 * Description:
 * Class Name:LenientTest
 * Date:2022/2/21 16:14
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第7章_Java基础类库._7_4_Java8的日期_时间类._7_4_2_Calendar类;

import java.util.Calendar;

public class LenientTest {
    public static void main(String[] args) {
        Calendar cal = Calendar.getInstance();
        cal.set(Calendar.MONTH, 13);
        System.out.println(cal.getTime());
        // 关闭容错性
        cal.setLenient(false);
        cal.set(Calendar.MONTH, 13);
        System.out.println(cal.getTime());      // 会抛出非法参数的错误
    }
}
